<template>
  <div>
    <el-time-picker
      :type="fieldArguments.type"
      :clearable="fieldArguments.clearable"
      :placeholder="fieldArguments.placeholder"
      :start-placeholder="fieldArguments.start_placeholder"
      :end-placeholder="fieldArguments.end_placeholder"
      :picker-options="fieldArguments.picker_options"
      :align="fieldArguments.align"
      :value-format="fieldArguments.value_format"
      @change="onChange"
      v-model="child_defaultValue"
      >
    </el-time-picker>
  </div>
</template>
<script>

  import Common from './js/Common'

  export default {
    name: 'sls-date-picker',
    mixins:[Common],
    data () {
      return {
        child_defaultValue:new Date(new Date().getTime()),
      }
    },
    mounted () {
      console.log('mounted')
      this.child_defaultValue = this.defaultValue;
      return;
      if(!this.defaultValue||this.defaultValue<999999999){
        this.child_defaultValue = new Date(new Date().getTime());
      }else{
        this.child_defaultValue = new Date(this.defaultValue*1000);
      };
    },

    watch: {
      defaultValue () {
        console.log('defaultValuechange',this.defaultValue);
        this.child_defaultValue = this.defaultValue;
        return;
        if(!this.defaultValue||this.defaultValue<999999999){
          this.child_defaultValue = new Date(new Date().getTime());
        }else{
          this.child_defaultValue = new Date(this.defaultValue*1000);
        }
      },
    },
    computed: {},
    methods: {
      onChange (value) {
        const self = this;
        this.$emit('onChange', {field:self.field,value:value})
      },

    },

  }

</script>
